home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 4.8 KB | 190 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWGDIObj.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
- #ifdef FW_BUILD_WIN
-
- #ifndef FWGDIOBJ_H
- #define FWGDIOBJ_H
-
- #ifndef FWGRDEF_H
- #include "FWGrDef.h"
- #endif
-
- #ifndef FWGCONST_H
- #include "FWGConst.h"
- #endif
-
- #ifndef FWPAT_H
- #include "FWPat.h"
- #endif
-
- // ----- Foundation Layer -----
-
- #ifndef FWAUTODE_H
- #include <FWAutoDe.h>
- #endif
-
- //========================================================================================
- // Forward Class Declarations
- //========================================================================================
-
- #define FW_kNotStockObject -1
-
- //========================================================================================
- // Forward Class Declarations
- //========================================================================================
-
- //========================================================================================
- // class FW_SGDIObject
- //========================================================================================
-
- struct FW_CLASS_ATTR FW_SGDIObject
- {
- FW_SGDIObject()
- { fObject = NULL; fIsStock = FALSE; }
- FW_SGDIObject(HGDIOBJ hObject, FW_Boolean isStock)
- { fObject = hObject; fIsStock = isStock; }
-
- FW_Boolean operator==(const FW_SGDIObject& other) const
- { return fObject == other.fObject;}
- FW_Boolean operator!=(const FW_SGDIObject& other) const
- { return fObject != other.fObject;}
-
- FW_Boolean operator==(HGDIOBJ GDIObject) const
- { return fObject == GDIObject; }
- FW_Boolean operator!=(HGDIOBJ GDIObject) const
- { return fObject != GDIObject ;}
-
- operator HGDIOBJ() const
- { return fObject; }
-
- HGDIOBJ fObject;
- FW_Boolean fIsStock;
-
- private:
- FW_SGDIObject(const FW_SGDIObject& other);
- FW_SGDIObject& operator=(const FW_SGDIObject& other);
- };
-
- //========================================================================================
- // class FW_CPrivGDIObject
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CPrivGDIObject FW_AUTO_DESTRUCT_OBJECT
- {
- public:
- FW_CPrivGDIObject();
- virtual ~FW_CPrivGDIObject();
-
- void SetStockID(int stockID);
-
- void UnselectObject(HDC hdc);
- void SelectObject(HDC hdc);
-
- HGDIOBJ GetObject(HDC hdc);
-
- virtual HGDIOBJ CreateObject() = 0;
-
- private:
- void MakeGDIObject(FW_SGDIObject& GDIObject);
- void DeleteGDIObject(FW_SGDIObject& GDIObject);
-
- protected:
- FW_SGDIObject fGDIObject;
-
- FW_Boolean fChanged;
-
- int fStockID;
- FW_Boolean fStockObject;
-
- HDC fDC;
- HGDIOBJ fPreviousObject;
- };
-
- //========================================================================================
- // class FW_CPrivGDIPen
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CPrivGDIPen : public FW_CPrivGDIObject
- {
- public:
- FW_CPrivGDIPen();
- virtual ~FW_CPrivGDIPen();
-
- void SetPenSize(int width);
- void SetPenStyle(FW_EStyleDash dashStyle);
- void SetPenColor(COLORREF color);
-
- virtual HGDIOBJ CreateObject();
-
- int GetPenSize();
-
- private:
- int fWidth;
- FW_EStyleDash fDashStyle;
- COLORREF fColor;
- };
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivGDIBrush::GetPenSize
- //----------------------------------------------------------------------------------------
-
- inline int FW_CPrivGDIPen::GetPenSize()
- {
- return fWidth;
- }
-
- //========================================================================================
- // class FW_CPrivGDIBrush
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CPrivGDIBrush : public FW_CPrivGDIObject
- {
- public:
- FW_CPrivGDIBrush();
- virtual ~FW_CPrivGDIBrush();
-
- void SetBrushPattern(const FW_PPattern& pattern);
- void SetBrushColor(COLORREF color);
-
- virtual HGDIOBJ CreateObject();
-
- HBRUSH GetBrush(HDC hdc);
-
- private:
- FW_Boolean fSolidColorBrush;
- COLORREF fColor;
- FW_PPattern fPattern;
- };
-
- //========================================================================================
- // class FW_CPrivGDIFont
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CPrivGDIFont : public FW_CPrivGDIObject
- {
- public:
- FW_CPrivGDIFont();
- virtual ~FW_CPrivGDIFont();
-
- void SetFontName(const char* fontName);
- void SetFontStyle(FW_FontStyle fontStyle);
- void SetFontSize(short fontSize);
-
- virtual HGDIOBJ CreateObject();
-
- private:
- char fFontName[LF_FACESIZE];
- FW_FontStyle fFontStyle;
- short fFontSize;
- };
-
- #endif
-
- #endif
-